<template>
	<div>
		<div class="mb20">
			<span class="index_num success_bg">2</span>
			<b class="f14">文件</b>
		</div>
		<table class="mb20 owntable" border="0" cellspacing="0" cellpadding="1" style="width: 100%;">
			<tr>
				<td class="white_bg flex_between">
					<div>
						<el-popover placement="top-start" trigger="hover" v-if="detail.isEncryption == 1">
							<div class="mb10 deepgray_f">请先申请文件解密</div>
							<div class="pointer" slot="reference">
								<span class="main_co">{{ detail.name }}</span>
								<i class="el-icon-lock warn_f ml10 f14"></i>
							</div>
						</el-popover>
						<span v-else class="pointer main_co" @click="preContent(detail, type)">{{ detail.name }}</span>
					</div>
					<div><el-button size="mini" v-if="detail.isSystemCover == '1'" @click="pre(detail)">封面预览</el-button></div>
				</td>
			</tr>
		</table>

		<pdf :pdfUrl="src" ref="pdf"></pdf>
	</div>
</template>

<script>
import pdf from '../pdf/index.vue';
export default {
	components: {
		pdf
	},
	props: {
		type: {
			type: [Number, String],
			default: 4
		},
		detail: {
			type: Object,
			default() {
				return {};
			}
		}
	},
	data() {
		return {
			src: ''
		};
	},
	methods: {
		pre(item) {
			if (item.templateCover) {
				this.src = item.templateCover;
				this.$refs.pdf.open();
			}
		}
	}
};
</script>

<style></style>
